-
-
Notifications
You must be signed in to change notification settings - Fork 612
Add FORCE_SQLITE Toggle to Avoid Database Conflicts #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add FORCE_SQLITE Toggle to Avoid Database Conflicts #334
Conversation
@claude review this and propose a solution |
1 similar comment
@claude review this and propose a solution |
Claude encountered an error —— View job I'll analyze this and get back to you. |
@claude review and if this issue is a valid issue fix it |
Claude encountered an error —— View job I'll analyze this and get back to you. |
1 similar comment
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a FORCE_SQLITE toggle to the database configuration to avoid conflicts when using Supabase/Postgres in production, enhances logging, and provides an optional patch system with documentation updates.
- Introduces FORCE_SQLITE in db.py and its counterpart copy in codePatches.
- Adds detailed logging for connection decisions.
- Updates the README and .gitignore and provides a patch directory with supporting documentation.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
praisonai/ui/db.py | Adds FORCE_SQLITE toggle, conditional DB URL selection, and logging. |
praisonai/ui/README.md | Updates documentation to explain the new toggle functionality. |
codePatches/praisonai/ui/db.py | Provides a patched copy reflecting FORCE_SQLITE toggle usage. |
codePatches/README | Documents instructions for applying the patch. |
PraisonAI.code-workspace | Updates workspace configuration to include the patch directory. |
# Without an option for toggling this on or off this easily causes conflicts, and is intrusive | ||
# self.database_url = os.getenv("DATABASE_URL") | ||
# supabase_url = os.getenv("SUPABASE_DATABASE_URL") | ||
# if supabase_url: | ||
# self.database_url = supabase_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the commented-out code block (lines 79-83) if it is no longer necessary to reduce clutter and improve maintainability.
# Without an option for toggling this on or off this easily causes conflicts, and is intrusive | |
# self.database_url = os.getenv("DATABASE_URL") | |
# supabase_url = os.getenv("SUPABASE_DATABASE_URL") | |
# if supabase_url: | |
# self.database_url = supabase_url | |
# (No replacement lines; the block is removed entirely.) |
Copilot uses AI. Check for mistakes.
cd /path/to/venvPraison/lib/python3.11/site-packages/ | ||
|
||
1. codePatches/praisonai/ui/db.py | ||
- fixes error where praisonAi tries to gain access to supabase or postgres isntance of production code. this is disallowed because of a table conflict in the [users] table where an either or relationship is caused by conflict schema between the two applications prismScape and praisonAi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the spelling of 'isntance' to 'instance' in this line for clarity.
- fixes error where praisonAi tries to gain access to supabase or postgres isntance of production code. this is disallowed because of a table conflict in the [users] table where an either or relationship is caused by conflict schema between the two applications prismScape and praisonAi | |
- fixes error where praisonAi tries to gain access to supabase or postgres instance of production code. this is disallowed because of a table conflict in the [users] table where an either or relationship is caused by conflict schema between the two applications prismScape and praisonAi |
Copilot uses AI. Check for mistakes.
Description:
This pull request introduces a FORCE_SQLITE toggle to address database conflicts when using PraisonAI in environments where Supabase or PostgreSQL databases are active. Additionally, it includes a README update and an optional patch system for ease of use in similar situations.
Here’s a well-formatted description for your pull request:
Title:
Add FORCE_SQLITE Toggle to Avoid Database Conflicts
Description:
This pull request introduces a
FORCE_SQLITE
toggle to address database conflicts when usingPraisonAI
in environments where Supabase or PostgreSQL databases are active. Additionally, it includes a README update and an optional patch system for ease of use in similar situations.Changes:
FORCE_SQLITE
Toggle indb.py
FORCE_SQLITE
) has been added to thepraisonai/ui/db.py
file.True
,PraisonAI
will bypass the detection of Supabase/Postgres and exclusively use SQLite as the database backend.users
table definitions betweenPraisonAI
and production applications.Enhanced Logging
Patch System Directory
codePatches
directory with a copy of the patcheddb.py
for users who might need to apply similar fixes without editing the source directly.README
file to explain the purpose and usage of these patches.Updated
.gitignore
Documentation
praisonai/ui/README.md
file to include an explanation of theFORCE_SQLITE
feature and how to enable it.Why This Change Is Necessary:
PraisonAI
and a production application share the same.env
file,PraisonAI
prioritizes Supabase/Postgres connections over SQLite. This leads to schema conflicts, particularly with theusers
table.FORCE_SQLITE
toggle, users can explicitly directPraisonAI
to use a local SQLite database, ensuring separation between production databases and the tool's data needs.How to Use:
FORCE_SQLITE = True
inpraisonai/ui/db.py
..env
file does not interfere with this behavior.PraisonAI
as usual; it will now use SQLite exclusively.Notes for Maintainers:
FORCE_SQLITE
) is desirable, I am happy to contribute a separate PR to introduce a centralized config system.FORCE_SQLITE
toggle in the primary documentation for broader user awareness.Testing:
Supabase
+PraisonAI
) and confirmed that enabling theFORCE_SQLITE
toggle successfully isolatedPraisonAI
to SQLite.Let me know if there are any additional adjustments you'd like me to make! It is my opinion that this would be well suited for a centralized config file where the user can select whichever database they want used instead of having auto-detect, or in addition to having autodetect.
I love you work!